<html>
<head>
<title>Grocery Shop</title>
<link rel="stylesheet" type="text/css" href="css/basic.css">
</head>
<body>
<?php
	include("misc.inc");
	$cxn = mysqli_connect($host,$user,$passwd,$dbname)
		or die ("couldn't connect to server");
		
		/* Select all categories from GroceryType table */
		$query = "SELECT * FROM groceryType ORDER BY groceryType";
		$result = mysqli_query($cxn,$query)
		or die ("Couldn't execute query.");
		
		/* Display text before form */
		echo "<div>\n
		<h1>Grocery Shop</h1>\n
		<h2>The following delicate
			items are waiting for you.</h2>\n
		<p>Find just what you want
			and hurry in to the store to pick up your 
			favorite groceries.</p>
		<h3>Select a food category below</h3>\n";
		
		/* From creation with selection list */
		
		echo "<form action='ShowCatalog.php' method='POST'>\n";
		echo "<table class='table'>";
		$counter=1;
		while($row = mysqli_fetch_assoc($result))
			{
			extract($row);
			echo "<tr><td class='choice'>\n"; 
			echo "<input type='radio' name='interest' value='$groceryType'\n";
			if( $counter == 1 )
			{
				echo "checked='checked'";
			}
				echo ">$groceryType</td>";
				echo "<td class='desc'>$typeDescription</td></tr>";
				$counter++;
		}
		echo "</table>";
		echo "<p><input type='submit' value='Select Grocery Type' class='btn'>
			  </form></p>\n";
			  
		echo "<p class='small'> <a href='login.php'>Admin login</a> </p>";
?>
</div>
</body></html>
